<template>
  <view class="wrap">
    <view class="box">
    	<view class="item">
    		<view class="title">用户类型</view>
			<!-- 1 个人  2企业 -->
			<view class="text">{{signDetailsData.userType == 1 ? '个人' : '企业'}}</view>
    	</view>
		<view class="item">
			<view class="title">企业名称</view>
			<view class="text">{{signDetailsData.name}}</view>
		</view>
		<view class="item">
			<view class="title">店名</view>
			<view class="text">{{signDetailsData.storeName}}</view>
		</view>
		<view class="item">
			<view class="title">联系人</view>
			<view class="text">{{signDetailsData.contact}}</view>
		</view>
		<view class="item">
			<view class="title">合同有效期</view>
			<view class="text">{{signDetailsData.contractValidity}}</view>
		</view>
		<view class="item" style="flex-direction: column;    align-items: start;">
			<view class="title">油品及种类</view>
			<view class="text">{{signDetailsData.oilTypeAndName}}</view>
		</view>
		<view class="item">
			<view class="title">清掏服务费</view>
			<view class="text">{{signDetailsData.chargingStandard}}</view>
		</view>
		<view class="item">
			 <!-- contractStatus 0未签约1正常,3已过期 -->
			<view class="title">合同状态</view>
			<view class="text" style="color: #138E57;" v-if="isTime">生效中</view>
			<view class="text" style="color: #FC880C;"  v-if="!isTime">已过期</view>
		</view>
		
    </view>
  </view>
</template>

<script>
import { getToken } from "@/utils/auth";

import { signDetails,InSignUnitList} from "@/api";
export default {
  components: {
  },
  data() {
    return {
		signDetailsData:[],
    };
  },
  computed: {
    isLogin() {
      return this.$store.state.isLogin;
    },
    userInfo() {
      return this.$store.state.userInfo;
    },
	isTime(){
		let status = false
		// contractValidity 到期时间
		//到期时间
		var startTime = this.signDetailsData.contractValidity
		//当前时间
		var currentDate = new Date();
		var currentDateStr = currentDate.getFullYear() + '-' + (currentDate.getMonth() + 1) + '-' + currentDate.getDate();
		if (new Date(currentDateStr).getTime() > new Date(startTime).getTime()) {
			// 到期
			status = false
		}else{
			status = true
		}
		return status
		// <!-- contractStatus 0未签约1正常,3已过期 -->
	},
  },
  onShow() {
	this.signDetails()
  },
  methods: {	
    // 签约信息
    signDetails(id) {
		let deptId = uni.getStorageSync('deptId') 
		// console.log("uni.getStorageSync('deptId')",uni.getStorageSync('deptId'));
    	signDetails({
			deptId:deptId
		}).then(res => {
    		this.signDetailsData = res.data
    	})
    },
  },
};
</script>

<style lang="less" scoped>
.wrap{
	padding: 30rpx;
	.box{
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 0 30rpx;
		.item{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 20rpx 0;
			border-bottom: 1rpx solid #D9D9D9;
			&:last-of-type{
				border: none;
			}
			.title{
				height: 60rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 30rpx;
				color: #000000;
				line-height: 60rpx;
				text-align: left;
			}
			.text{
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 30rpx;
				color: #666668;
			}
		}
	}
}
</style>
